package thread;

import java.util.Arrays;

class SimpleArrayList{
    private Object[] array;
    private int size;

    public SimpleArrayList(int capacity) {
        this.array = new Object[capacity];
    }

    public synchronized void add(Object obj){
        if (size == array.length){
            array= Arrays.copyOf(array,array.length*2);
        }

        array[size] = obj;

        size++;

    }

    public int size(){
        return size;
    }

}

public class SimpleArrayListDemo01 {


}
